<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:s="http://jboss.com/products/seam/taglib"
    template="/layout/template.xhtml">

    <ui:define name="head">
      <link href="../stylesheet/useradmin.css" rel="stylesheet" type="text/css"/>
    </ui:define>

    <ui:define name="body">

        <h1>User Details</h1>

        <ice:form id="userForm">

            <ice:panelGroup styleClass="useradmin"> 
                <s:decorate id="usernameField" template="/layout/edit.xhtml">
                    <ui:define name="label">Username</ui:define>
                    <ice:inputText id="username" value="#{userAction.username}" readonly="#{identityManager.userExists(userAction.username)}"/>
                </s:decorate>

                <s:decorate id="passwordField" template="/layout/edit.xhtml">
                    <ui:define name="label">Password</ui:define>
                    <ice:inputSecret id="password" value="#{userAction.password}"/>
                </s:decorate>

                <s:decorate id="confirmField" template="/layout/edit.xhtml">
                    <ui:define name="label">Confirm password</ui:define>
                    <ice:inputSecret id="confirm" value="#{userAction.confirm}"/>
                </s:decorate>

                <s:decorate id="rolesField" template="/layout/edit.xhtml">
                    <ui:define name="label">Member of roles</ui:define>
                    <div class="selectMany">
                        <ice:selectManyCheckbox id="roles" value="#{userAction.roles}" layout="pageDirection" styleClass="roles">
                            <s:selectItems value="#{identityManager.listGrantableRoles()}" var="_role" label="#{_role}"/>
                        </ice:selectManyCheckbox>
                    </div>
                </s:decorate>

                <s:decorate id="enabledField" template="/layout/edit.xhtml">
                    <ui:define name="label">Account enabled</ui:define>
                    <ice:selectBooleanCheckbox id="enabled" value="#{userAction.enabled}"/>
                </s:decorate>

                <div style="clear:both"/>

            </ice:panelGroup>

            <div class="actionButtons">
                <ice:commandButton id="save" value="Save" action="#{userAction.save}"/>
                <s:button id="cancel" view="/useradmin/usermanager.xhtml" value="Cancel" propagation="end"/>
            </div>

        </ice:form>

    </ui:define>

</ui:composition>
